<!-- sua bai viet-->
<?php echo validation_errors(); 
$data1 = array(
               'status' => 1
            );
$this->db->where('id', $data->id);
$this->db->update('order', $data1);
//get iduser
$data2=$data;
$data = $this->Admin_model->get_one('users',array('id'=>$data->id_user));

$this->db->select('
                   order_details.*, 
                   product.id,
                   product.title,
                   product.price as giasanpham                   
                        ');
$this->db->where('id_order',$data2->id);
$this->db->from('order_details');
$this->db->join('product', 'product.id = order_details.id_sp');
$query = $this->db->get();
$donhang= $query->result();



?>

<div class="box_heading">
    <div class="icon">
    <img src="<?php echo base_url().'skin/admin/images/icon_settings.png';?>"/> Thông tin người mua hàng( <span style="color: red;"> * : không được để trống</span> )  <?php if(!empty($thongbao)){echo '<img src='.base_url().'template/admin/images/ok.png class="ok"><font color=red><b>'.$thongbao.'</b></font>';}?>
    </div>
    <div class="right">    
    <a href="<?php echo base_url().'admin/xuly/order/list';?>">Quay lại</a>
    </div>
</div>

<div class="box_noidung">
<table class="form">
<tr><td><font color=red>* </font>Tên</td><td><?php if(!empty($data)){echo $data->hoten;};?></td></tr>
<tr><td><font color=red>* </font>Email</td><td><?php if(!empty($data)){echo $data->email;};?></td></tr>
<tr><td><font color=red>* </font>Điện thoại</td><td><?php if(!empty($data)){echo $data->phone;};?></td></tr>
<tr><td><font color=red>* </font>Địa chỉ</td><td><?php if(!empty($data)){echo $data->diachi;};?></td></tr>
<tr><td><font color=red>* </font>Ngày gửi</td><td><?php if(!empty($data)){echo $data->created;};?></td></tr>

</table>

<h2>
Sản phẩm đặt mua:
</h2>
<table class="form">
<?php
 $gia = 0;
 $i=0;
if(!empty($donhang)){
    echo '
        <tr>
            <th>#</th>
            <th>Tên sản phẩm</th>  
             <th>Ngày mua</th>          
            <th>Giá</th>  
            <th>Số lượng</th>         
            <th>Thành tiền</th>            
            <th>Địa chỉ IP</th>
        </tr>';
    foreach ($donhang as $donhang){
        $i++;
        $gia = $gia +$donhang->price*$donhang->qty;
        echo '
        
        <tr>
            <td>'.$i.'</td>
            <td>'.$donhang->title.'</td>
            <td>'.$donhang->created.'</td>            
            <td>'.VndDot($donhang->price).'đ</td>
            <td>'.$donhang->qty.'</td>
            <td>'.VndDot($donhang->price*$donhang->qty).'đ</td>
            <td>'.$donhang->ip.'</td>
        </tr>
       
        
        ';
    }
   
}
?>

</table>
<?php
 echo '<h3>Tổng:$'.VndDot($gia).'</h3>';
 ?>



</div>
